package com.wyman.factory.support;

import com.wyman.factory.core.io.DefaultResourceLoader;
import com.wyman.factory.core.io.ResourceLoader;

/**
 * @Author 李伟民
 * @Description
 * @DateTime 2024/12/6 01:58
 */

//负责实现非接口核心功能
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader{

    //DefaultListableBeanFactory 实现了eanDefinitionRegistry 本质就是它
    private final BeanDefinitionRegistry beanDefinitionRegistry;

    private ResourceLoader resourceLoader;


    public AbstractBeanDefinitionReader(BeanDefinitionRegistry beanDefinitionRegistry){
        this.beanDefinitionRegistry = beanDefinitionRegistry;
        resourceLoader = new DefaultResourceLoader();

    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry beanDefinitionRegistry,ResourceLoader resourceLoader){

        this.beanDefinitionRegistry = beanDefinitionRegistry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return beanDefinitionRegistry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }
}
